<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAccountsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('accounts', function (Blueprint $table) {
            $table->id();
            // 手机号字段（唯一约束）
            $table->string('account', 20)
                ->unique()
                ->comment('手机号');
 
            // 密码字段（可空，允许纯手机号登录）
            $table->string('password', 60)
                ->nullable()
                ->comment('密码');
 
            // 验证Token字段
            $table->string('token', 60)
                ->nullable()
                ->comment('API验证Token');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('accounts');
    }
}
